//
//  RemindTableViewCell.m
//  NuwaRobot
//
//  Created by Kendama on 2017/12/2.
//  Copyright © 2017年 Kendama. All rights reserved.
//

#import "RemindTableViewCell.h"

@implementation RemindTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = rgba(27,44,81,1);
        [self masLayoutSubview];
    }
    return self;
}

- (UIImageView *)iconImageView
{
    if(!_iconImageView)
    {
        UIView *superView = self.contentView;
        _iconImageView = [[UIImageView alloc]init];
        [superView addSubview:_iconImageView];
    }
    return _iconImageView;
}
- (UILabel *)titleLabel
{
    if(!_titleLabel)
    {
        UIView *superView = self.contentView;
        _titleLabel = [[UILabel alloc]init];
        [superView addSubview:_titleLabel];
        [_titleLabel setFont:fontCommonSize];
        [_titleLabel setTextColor:[UIColor whiteColor]];
    }
    return _titleLabel;
}
- (UILabel *)dateLabel
{
    if(!_dateLabel)
    {
        UIView *superView = self.contentView;
        _dateLabel = [[UILabel alloc]init];
        [superView addSubview:_dateLabel];
        [_dateLabel setFont:fontWithSize(13)];
        [_dateLabel setTextColor:rgba(88,111,161,1)];
    }
    return _dateLabel;
}
- (UILabel *)timeLabel
{
    if(!_timeLabel)
    {
        UIView *superView = self.contentView;
        _timeLabel = [[UILabel alloc]init];
        [superView addSubview:_timeLabel];
        [_timeLabel setFont:fontCommonSize];
        [_timeLabel setTextColor:[UIColor whiteColor]];
    }
    return _timeLabel;
}

//- (void)layoutSubviews
//{
//    [self masLayoutSubview];
//}

- (void)masLayoutSubview
{
    __weak UIView *superView = self.contentView;
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(superView.mas_centerY);
        make.left.mas_equalTo(superView.mas_left).with.offset(px1080Width(33));
        make.height.width.mas_equalTo(px1920Height(56));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(superView.mas_centerY).with.offset(-px1920Height(10));
        make.left.mas_equalTo(self.iconImageView.mas_right).with.offset(px1080Width(41));
        make.right.mas_equalTo(superView.mas_right).with.offset(-px1080Width(33));
    }];
    
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(superView.mas_centerY).with.offset(px1920Height(10));
        make.left.mas_equalTo(_titleLabel);
        make.width.mas_equalTo(120);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_dateLabel);
        make.left.mas_equalTo(_dateLabel.mas_right).with.offset(px1080Width(33));
        make.width.mas_equalTo(50);
    }];
    
    
}

@end
